import Vuex from 'vuex'
import login from './modules/login.js'

const store = new Vuex.Store({
	state: {
		gateway: "",
		loading: 0,
		tabbar: false,
		accountInfo: null
	},
	mutations: {
		showLoading(state) {
			state.loading++;
		},
		hideLoading(state) {
			if (state.loading > 0) state.loading--;
		},
		showTabbar(state) {
			state.tabbar = true;
		},
		hideTabbar(state) {
			state.tabbar = false;
		},
		setAccountInfo(state, payload) {
			state.accountInfo = payload.accountInfo;
		},
	},
	modules: {
		login
	}
})

export default store